<?php

namespace app\model;

use app\BaseModel;
use think\model\relation\BelongsTo;

/**
 * 量表问题答案表
 */
class RatingScaleQuestionAnswerModel extends BaseModel
{
    protected $name = 'rating_scale_question_answer';

    /**
     * 新增数据验证
     * @return array
     */
    public function addValidate(): array
    {
        return [
            'question_id|量表问题id'  => 'require',
            'name|答案'  => 'require',
            'score|得分'  => 'require',
        ];
    }

    /**
     * 关联量表题目
     * @return BelongsTo
     */
    public function question(): BelongsTo
    {
        return $this->belongsTo('RatingScaleQuestionModel','question_id');
    }
}